defmodule ProgContest.Repo.Migrations.CreateQuizzes do
  use Ecto.Migration

  def change do
    create table(:quizzes) do
      add :title, :text, null: false
      add :question, :text, null: false
      add :author, :text, null: false
      add :contest_id, references(:contests, on_delete: :restrict)

      timestamps(type: :timestamptz)
    end

    create index(:quizzes, [:contest_id])
  end
end
